import {wx} from '../../../../weixin2alipay/index.js';
import {Page,Component} from '../../../../weixin2alipay/index.js';
const types = [
  'default',
  'primary',
  'warn'
];
const pageObject = {
    "data":{
        "defaultSize":'default',
        "primarySize":'default',
        "warnSize":'default',
        "disabled":false,
        "plain":false,
        "loading":false
},
    "onShareAppMessage"(){
      return {
        "title":'button',
        "path":'page/component/pages/button/button'
};
    },
    "setDisabled"(){
      this.setData({
        "disabled":! this.data.disabled
});
    },
    "setPlain"(){
      this.setData({
        "plain":! this.data.plain
});
    },
    "setLoading"(){
      this.setData({
        "loading":! this.data.loading
});
    },
    "handleContact"(e){
      console.log(e.detail);
    },
    "handleGetPhoneNumber"(e){
      console.log(e.detail);
    },
    "handleGetUserInfo"(e){
      console.log(e.detail);
    },
    "handleOpenSetting"(e){
      console.log(e.detail.authSetting);
    },
    "handleGetUserInfo"(e){
      console.log(e.detail.userInfo);
    }
};
for(let i = 0;i < types.length;++i){
  (function(type){
    pageObject[type] = function(){
    const key = type + 'Size';
    const changedData = {};
    changedData[key] = (this.data[key] == 'default')?'mini':'default';
    this.setData(changedData);
  };
  }(types[i]));
};
Page(pageObject);

